FROM python:3.11-slim

# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /usr/local/bin/uv /usr/bin/uv
RUN chmod +x /usr/bin/uv

# 复制项目文件和启动脚本
WORKDIR /app
COPY . /app
COPY entrypoint.sh /entrypoint.sh

# 设置权限并安装依赖
RUN chmod +x /entrypoint.sh && \ 
    uv sync --frozen --no-cache

# 通过脚本启动
ENTRYPOINT ["/entrypoint.sh"]
CMD ["uv", "run", "server/main.py"]